﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace example02
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void rbnCong_CheckedChanged(object sender, EventArgs e)
        {
            if (rbnCong.Checked == true)
            {
                btnCong.Text = "Cộng";
            }
        }

        private void rbnTru_CheckedChanged(object sender, EventArgs e)
        {
            if (rbnTru.Checked == true)
            {
                btnCong.Text = "Trừ";
            }
        }

        private void btnCong_Click(object sender, EventArgs e)
        {
            int a = int.Parse(txtSoA.Text);
            int b = int.Parse(txtSoB.Text);
            int c = 0;
            if (rbnTru.Checked == true)
            {
                c = a - b;
            }
            else
            {
                c = a + b;
            }
            txtketqua.Text = c.ToString();
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnThoat_Click_1(object sender, EventArgs e)
        {
            this.Close();
        }


    }
}
